package com.example.cslp.service.Impl;

import com.example.cslp.mapper.NoticeMapper;
import com.example.cslp.pojo.entity.Notice;
import com.example.cslp.service.NoticeService;
import com.example.cslp.util.TimeUtil;
import com.example.cslp.web.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class NoticeServiceImpl implements NoticeService {
    @Autowired
    public NoticeMapper noticeMapper;
    //创建公告
    public Boolean createNotice(Notice notice){
        //返回true
            return noticeMapper.createNotice(notice);
        }


    //编辑公告
    public Boolean editNotice(Notice notice){
        return noticeMapper.editNotice(notice);
    }

    //查询所有公告
    public List<Notice> queryNotice(){
        List<Notice> notices = noticeMapper.queryNotice();
        log.debug("queryNotice查询到:{}",notices);
        return notices;
    }
    //删除公告
    public Boolean deleteNotice(Notice notice){
        return noticeMapper.deleteNotice(notice);
    }
}
